package cn.cloud9.designpattern.dp08flyweight.ticket;

import java.math.BigDecimal;
import java.util.Random;

/**
 * @projectName: Java
 * @author: 戴知舟
 * @date: 2022年05月24日 13:38
 * @version: 1.0
 */
public class TrainTicket implements ITicket {

    private String from;
    private String to;
    private BigDecimal price;

    public TrainTicket(String from, String to) {
        this.from = from;
        this.to = to;
    }

    @Override
    public void showInfo(String bunk) {
        this.price = new BigDecimal(new Random().nextInt(500));
        System.out.println(this.from + " -> " + this.to + " : " + bunk + " price:" + this.price );
    }
}
